package com.body;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

public class exit extends HttpServlet{
	private HttpSession session = null;  //session
	private PrintWriter out = null;
	
	@Override
	public void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		// TODO Auto-generated method stub
		session  = req.getSession();
		session.invalidate();
		resp.setHeader("Content-type", "text/html;charset=utf-8");  
		out = resp.getWriter();
		out.print("<script  type='text/javascript'  >; window.location.href=document.referrer;  </script>");
	}
	
	@Override
	public void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		// TODO Auto-generated method stub
		doPost(req,resp);
	}
}
